package com.ideaaedi.zoo.commonbase.entity.codemsg;

import lombok.Getter;

/**
 * code message
 *
 * @author <font size = "20" color = "#3CAA3C"><a href="https://gitee.com/JustryDeng">JustryDeng</a></font> <img src="https://gitee.com/JustryDeng/shared-files/raw/master/JustryDeng/avatar.jpg" />
 * @since 1.0.0
 */
@Getter
public enum ZooBaseCodeMsgEnum implements CodeMsgProvider {
    
    /** [100102, 100200) 用户相关 */
    OBTAIN_USER_ID_FAIL("zf-bs-100001", "获取当前用户ID失败"),
    OBTAIN_USER_TENANT_SCOPE_FAIL("zf-bs-100002", "获取用户数据域信息失败"),
    OBTAIN_USER_TENANT_INSERT_SCOPE_FAIL("zf-bs-100003", "获取当前用户数据写入域失败"),
    NO_DATA_SCOPE_READ("zf-bs-100004", "没有任何可读的数据域"),
    NO_DATA_SCOPE_UPDATE("zf-bs-100005", "没有任何可写的数据域"),
    
    /** [100201, 100400) 分库分表相关 */
    SHARDING_SQL_MISUSE("zf-orm-100201", "多分表关联查询SQL编写有误，需要明确限定每个分表的分片列值"),
    QUERY_TIME_RANGE_EXCEEDED_SHARDING_CONFIG_TIME_RANGE_LIMIT("zf-orm-100202", "查询时间范围超出允许查询的最大范围"),
    
    
    /** [100400, 100600) 数据库相关 */
    ILLEGAL_SQL("zf-orm-100401", "SQL非法，请检查语法"),
    ;
    
    private final String code;
    
    private final String message;
    
    ZooBaseCodeMsgEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }
    
    @Override
    public String code() {
        return this.code;
    }
    
    @Override
    public String message() {
        return this.message;
    }
    
    @Override
    public String toString() {
        return "{\"code\":\"" + code + "\", \"message\":\"" + message + "\"}";
    }
}
